/* 
 * File:   Config.h
 * Author: ja1e09
 *
 * Created on July 29, 2011, 12:13 PM AAA
 */

#ifndef CONFIG_H
#define	CONFIG_H

#include "Global.h"
#include "Definitions.h"
#include "Console.h"
#include "tinyxml.h"

class Console;

#define MAX_DATA_TYPES 7

enum DATA_TYPES
{
    TYPE_INT, TYPE_UINT, TYPE_FP, TYPE_DFP, TYPE_BOOL, TYPE_STR, TYPE_LONG
};

// Singleton Class

class Config
{
public:
    static Config* GetInstance();
    void Destroy(void);
    const bool Init();

    const bool AddItemToMap(const char* pName, const char* pType, const char* pData);
    const bool AddIntToMap(const char* pName, const int iData);
    const bool AddUIntToMap(const char* pName, const unsigned int uData);
    const bool AddFPToMap(const char* pName, const float fData);
    const bool AddDFPToMap(const char* pName, const double dData);
    const bool AddBoolToMap(const char* pName, const bool bData);
    const bool AddStrToMap(const char* pName, const std::string sData);

    const std::string GetStr(const char* pName);
    const float GetFP(const char* pName);
    const double GetDFP(const char* pName);
    const bool GetBool(const char* pName);
    const int GetInt(const char* pName);
    const unsigned int GetUInt(const char* pName);

protected:
    Config();
    Config(const Config&);
    Config& operator=(const Config&);

private:
    static Config* pInstance;
    TiXmlDocument XML_Config;
    std::map<std::string, boost::any> mConfig;
    const int GetTypeFromStr(const char* pType);


};

#endif	/* CONFIG_H */

